package com.woniuxy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @BelongsProject: java-85-course-code
 * @BelongsPackage: com.woniuxy.controller
 * @Author: LiTongMiao
 * @Date: 2022/1/25 17:05
 * @Description: TODO
 */

/**
 * 用户管理的控制器
 */
@RequestMapping("/managerController")
@RestController
public class ManagerController {
    @RequestMapping("/findOne")
    public String findOne(ModelMap model,String name){
        model.addAttribute("msg",name+"，你好");
        return "myTest";
    }
    @RequestMapping("/doGet")
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("执行业务代码");
        String name = request.getParameter("name");
        //这里可以去直接 跳转到controller的其他请求中
        //request.getRequestDispatcher("/managerController/findOne").forward(request, response);
        //这里也可以直接跳转到新的界面
        request.getRequestDispatcher("/WEB-INF/jsp/success.jsp").forward(request, response);

    }

}
